﻿#region Using directives

using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;

#endregion

namespace Demo1
{


    public class JobInfo
    {

		public JobInfo(int id)
		{
			_id = id;
		}

		public int _id;

        public IEnumerator m_ProcessEnum;
        //차후배열로도 가능?
        public ICondition m_Condition;

    }


    public interface ICondition
    {

        bool IsComplete();
		void Cancel();

    }

    // 특정 시간을 기다리는 타이머 컨디션
    public class conTimer : ICondition
    {
        DateTime m_Time;


		double _waitTime;

		public delegate void Complete(double time);
		public delegate void Fail(double time);

		public conTimer(double sec)
        {
			_waitTime = sec;
            m_Time = DateTime.Now + TimeSpan.FromSeconds(sec);
        }

        public bool IsComplete()
        {

            if (DateTime.Now < m_Time)
            {
				// 아직 기다리는 시간이 남아있다.
                return false;
            }


			//_complete(_waitTime);

            return true;
        }


		public void Cancel()
		{
            //TimeSpan span = (m_Time - DateTime.Now);

            //_fail(_waitTime - (span.TotalMilliseconds / 1000.0));
		}

    }




    //public class delSkill 
    //{
    //    //int m_PCID;
    //    int m_Sec;


    //    CClinet _client;


    //    public delSkill(CClinet client, int sec)
    //    {
    //        //m_PCID = pcid;
    //        m_Sec = sec;
    //        _client = client;
    //    }

    //    public IEnumerator GetEnumerator()
    //    {

    //        Console.WriteLine("pc delSkill skill({0},{1})", _client.m_ID, m_Sec);
			
    //        yield return new conTimer(m_Sec,
    //            delegate(double time)
    //            {
    //                Console.WriteLine("conTimer complete");
    //            },

    //            delegate(double time)
    //            {
    //            }
    //            );

    //        _client.ClearProcess(0);

    //        yield break;
    //    }

    //    public bool CheckRange(int x, int y, int sx, int sy)
    //    {

    //        return true;
    //    }

    //}

}
